package cn.zswltech.gruul.xxljob;

import cn.zswltech.gruul.common.dal.tkmybatis.IMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @author Jim
 * @version 1.0.0
 * @descripition:
 * @date 2024/2/21 17:18
 */
@Mapper
public interface YunHuOrgMapper extends IMapper<YunHuOrg> {
    @Delete("<script>" +
            "delete from yunhu_org where org_id in\n" +
            "<foreach collection=\"list\" open=\"(\" close=\")\" item=\"item\" separator=\",\">\n" +
            "    #{item}\n" +
            "</foreach>" +
            "</script>")
    void batchDeleteByPrimaryKeys(List<String> orgIds);

    @Insert("<script>" +
            "insert into yunhu_org(org_id, work_addr, org_type_code, province_code, full_name, superior_org_id, org_type_name, short_name, org_code, gmt_create, \n" +
            "                      gmt_modified) \n" +
            "values \n" +
            "<foreach collection=\"list\" item=\"item\" separator=\",\">\n" +
            "    (#{item.orgId},\n" +
            "    #{item.workAddr},\n" +
            "    #{item.orgTypeCode},\n" +
            "    #{item.provinceCode},\n" +
            "    #{item.fullName},\n" +
            "    #{item.superiorOrgId},\n" +
            "    #{item.orgTypeName},\n" +
            "    #{item.shortName},\n" +
            "    #{item.orgCode},\n" +
            "    #{item.gmtCreate},\n" +
            "    #{item.gmtModified})\n" +
            "       </foreach>" +
            "</script>")
    void batchSave(List<YunHuOrg> yunHuOrgs);

}
